/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ctrl;

import java.util.Calendar;

public class Vario {

    public static String giorni(int day) {

        String ret = null;
        for (int i = 1; i < day; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        ret += "<option value=" + day + " SELECTED>" + day + "</option> ";
        for (int i = day + 1; i < 32; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        return ret;
    }

    public static String mesi(int month) {
        String ret = null;
        String[] vett = {"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"};
        for (int i = 0; i < month; i++) {
            ret += "<option value=" + i + " >" + vett[i] + "</option> ";
        }
        ret += "<option value=" + month + " SELECTED>" + vett[month] + "</option> ";
        for (int i = month + 1; i <= 11; i++) {
            ret += "<option value=" + i + " >" + vett[i] + "</option> ";
        }
        return ret;
    }

    public static String anni(int year) {
        String ret = null;
        for (int i = 2000; i > year; i--) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        ret += "<option value=" + year + " SELECTED>" + year + "</option> ";
        for (int i = year - 1; i >= 1900; i--) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        return ret;
    }

    public static String anni2(int year) {
        Calendar a = Calendar.getInstance();
        String ret = null;
        int start = a.get(Calendar.YEAR);
        for (int i = start; i < year; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        ret += "<option value=" + year + " SELECTED>" + year + "</option> ";
        for (int i = year + 1; i <= start + 4; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        return ret;
    }

    public static String num(int num) {
        String ret = null;
        for (int i = 0; i < num; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        ret += "<option value=" + num + " SELECTED>" + num + "</option> ";
        for (int i = num + 1; i < 20; i++) {
            ret += "<option value=" + i + " >" + i + "</option> ";
        }
        return ret;
    }
}
